<template>
	<view class="">
		<view class="guwen_list" v-for="item in jsonData" :key="item.mobile" @click="makePhoneBd(item)">
			<view class="flex">
				<view class="listImg">
					<u--image :showLoading="true" :src="item.headimg" mode="widthFix" width='100%'></u--image>
				</view>
				<view class="listName">
					{{item.title}}
				</view>
			</view>
			<view class="listTell">
				<u-icon name="phone" color="#c5a68a" size="24"></u-icon>
			</view>
		</view>

		<view class="empty" v-if="jsonData.length == 0">
			<u-empty mode="data" text="暂无客服"></u-empty>
			<view class="btns" @click="reBack">返回</view>
		</view>

	</view>
</template>
<script>
	export default {
		data() {
			return {
				id: 0,
				jsonData: [],
				listData: [{
						img: "https://tjyzsz.oss-cn-beijing.aliyuncs.com/seoYaZhongSheZhuang/demo/a.png",
						name: "银聪玲",
						mobile: "13937119120"
					},
					{
						img: "https://tjyzsz.oss-cn-beijing.aliyuncs.com/seoYaZhongSheZhuang/demo/b.png",
						name: "李鹏飞",
						mobile: "17737155068"
					},
					{
						img: "https://tjyzsz.oss-cn-beijing.aliyuncs.com/seoYaZhongSheZhuang/demo/c.png",
						name: "姜梦洁",
						mobile: "15515572809"
					},
				],

			};
		},
		onLoad(options) {
			this.id = options.id;
			this.getIndex();
		},
		methods: {

			reBack() {
				uni.navigateBack();
			},

			getIndex() {
				uni.$u.http.post("/getService", {
					id: this.id
				}).then((res) => {
					if (res.code == 200) {
						this.jsonData = res.data;
					}
				})
			},

			makePhoneBd(item) {
				uni.makePhoneCall({
					phoneNumber: item.mobile
				});
			},
		},
	};
</script>

<style lang="scss">
	.btns {
		width: 80%;
		margin: 20px auto;
		height: 42px;
		line-height: 42px;
		text-align: center;
		color: #ffffff;
		background-color: #55aaff;
		border-radius: 10px;
	}

	.guwen_list {
		display: flex;
		align-items: center;
		justify-content: space-between;
		border-bottom: 1px solid #ccc;
		padding: 30rpx;

		.flex {
			display: flex;
			align-items: center;
		}

		.listImg {
			width: 120upx;
			height: 120upx;
			border-radius: 100%;
			background: #efefef;
			overflow: hidden;
		}

		.listName {
			margin-left: 30rpx;
			font-size: 14px;
		}

		.listTell {}
	}
</style>